"""
爬取微博赞过的内容
https://blog.csdn.net/qq_33204297/article/details/87895477
"""
import json
import os

import requests

# headers作用为反爬
headers = {
    'Cookie': 'login_sid_t=3e61e90db210e2d865cfe38b9f68b3e8; cross_origin_proto=SSL; _s_tentry=passport.weibo.com; Apache=2024617387008.776.1550912473467; SINAGLOBAL=2024617387008.776.1550912473467; ULV=1550912473477:1:1:1:2024617387008.776.1550912473467:; SSOLoginState=1550912517; SCF=AuK3Eq-JkG6jrMruEXJ9RR0OCRGsrMU-V0Ay0uXxQeNipn2-icVEfnyWzgroN6QNKAdKbeSH4t8hRVBs0N58LJU.; SUB=_2A25xdXxWDeRhGeNI7VYR8ibLzDmIHXVSA-qerDV8PUNbmtBeLWShkW9NSFL5eoIO_K5uDxqPlhiBWoGNMcTx70v-; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WhYGb4-SAp5obSm.ebeXpMd5JpX5K2hUgL.Fo-cSoB7eonNS0-2dJLoIp7LxKML1KBLBKnLxKqL1hnLBoMfSoqXehzRS0Mf; SUHB=06Z1Udp4kRlhNk; ALF=1582448517; un=13836767328; wvr=6; ULOGIN_IMG=15509128764705; UOR=,,www.sogou.com; PHOTO-G0=8aae608225ce51dc489d4de036180247; WBStorage=201902231752|undefined; webim_unReadCount=%7B%22time%22%3A1550915600809%2C%22dm_pub_total%22%3A0%2C%22chat_group_pc%22%3A0%2C%22allcountNum%22%3A6%2C%22msgbox%22%3A0%7D',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0'
}

# 数据为json格式
text = "{\"result\":true,\"code\":0,\"msg\":\"\",\"timestamp\":1580535557,\"data\":{\"total\":164,\"photos_list\":[{\"name\":\"\\u51b0\\u6ceea\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5234448711,\"target_id\":\"4464389522788460\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"[\\u7ed9\\u4f60\\u5c0f\\u5fc3\\u5fc3][\\u7d2b\\u91d1\\u8349]2020\\u65b0\\u5e74\\u4e09\\u613f:\\n\\u201c\\u6709\\u4e8b\\u505a\\uff0c\\u6709\\u4eba\\u7231\\uff0c\\u6709\\u6240\\u671f\\u5f85\\u201d\\u3002\\n\\u5927\\u5bb6\\u65b0\\u5e74\\u5feb\\u4e50\\u5440\\u2728 \\u2728 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/005Ifde7ly1gb815xpznjj30u01hc7ma.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"005Ifde7ly1gb815xpznjj30u01hc7ma.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/4Eaa5v\\\" rel=\\\"nofollow\\\">\\u5c0f\\u7c73Note 3 \\u62cd\\u4eba\\u66f4\\u7f8e<\\/a>\"},{\"name\":\"\\u6211\\u60f3\\u5f53\\u9526\\u9ca4llly\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5861668638,\"target_id\":\"4463609021202217\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u9ebb\\u5c06\\ud83c\\udc04\\ufe0f\\u6253\\u8d77\\u6765[\\u7b11\\u800c\\u4e0d\\u8bed][\\u7b11\\u800c\\u4e0d\\u8bed] \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/006oGXMyly1gb5jir8dkhj30ya0u07cw.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"006oGXMyly1gb5jir8dkhj30ya0u07cw.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"\\u6587\\u5200\\u5218_\\u5efa\\u98deWInd\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5328028189,\"target_id\":\"4448806458334157\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u9a6c\\u4e0d\\u505c\\u8e44\\u7684\\u6539\\u53d8\\u81ea\\u5df1\\uff0c\\u4e5f\\u6539\\u53d8\\u751f\\u6d3b\\u3002\\n\\n      <img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/36\\/gza_org.gif\\\" title=\\\"\\u9f13\\u638c\\\"\\/> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/005OzRwxly1g9ubfsyrc3j30u00u0adr.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"005OzRwxly1g9ubfsyrc3j30u00u0adr.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"\\u51b0\\u6ceea\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5234448711,\"target_id\":\"4443007706744408\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u51b7\\u51ac\\u91cc\\u7684\\u4e00\\u676f\\u70ed\\u5de7 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/005Ifde7ly1g9btapl587j30u00tydg8.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"005Ifde7ly1g9btapl587j30u00tydg8.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/4Eaa5v\\\" rel=\\\"nofollow\\\">\\u5c0f\\u7c73Note 3 \\u62cd\\u4eba\\u66f4\\u7f8e<\\/a>\"},{\"name\":\"Mr\\u4e36\\u5f35\\u4f73\\u5be7\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5237759039,\"target_id\":\"4438289723261826\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u6765\\u5317\\u4eac\\u4e00\\u5e74\\u4e86 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx4.sinaimg.cn\\/small\\/005It6ovly1g8wrn8i6p6j30j60j60tt.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx4.sinaimg.cn\",\"pic_name\":\"005It6ovly1g8wrn8i6p6j30j60j60tt.jpg\",\"pic_type\":1,\"from\":\"\"},{\"name\":\"\\u51b0\\u6ceea\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5234448711,\"target_id\":\"4436728809201257\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u89c1\\u4e86\\u56db\\u5e74\\u672a\\u89c1\\u7684\\u4e00\\u4e2a\\u670b\\u53cb\\uff0c\\u867d\\u7136\\u65f6\\u95f4\\u5f88\\u77ed\\uff0c\\u4f46\\u662f\\u8fd8\\u662f\\u9ad8\\u4e2d\\u90a3\\u4e2a\\u611f\\u89c9\\uff0c\\u54c8\\u54c8\\u5f00\\u5fc3<img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/74\\/lxhainio_org.gif\\\" title=\\\"\\u597d\\u7231\\u54e6\\\"\\/><img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/74\\/lxhainio_org.gif\\\" title=\\\"\\u597d\\u7231\\u54e6\\\"\\/> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/005Ifde7ly1g8rscgnibvj30qo1beqea.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"005Ifde7ly1g8rscgnibvj30qo1beqea.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/4Eaa5v\\\" rel=\\\"nofollow\\\">\\u5c0f\\u7c73Note 3 \\u62cd\\u4eba\\u66f4\\u7f8e<\\/a>\"},{\"name\":\"\\u4f60\\u89c1\\u5230\\u6211\\u7684\\u5c0f\\u5f90\\u9e2d\\u4e86\\u5417\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5768508739,\"target_id\":\"4427575621813567\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u8212\\u670d\\u4e86 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/006io4Dxly1g7yl5c3yltj31400u0b29.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"006io4Dxly1g7yl5c3yltj31400u0b29.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"Mr\\u4e36\\u5f35\\u4f73\\u5be7\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5237759039,\"target_id\":\"4426771967167553\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u6210\\u4ed9\\u4e86 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/005It6ovly1g7w0ul869aj30cn0md3zh.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"005It6ovly1g7w0ul869aj30cn0md3zh.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/6NndUT\\\" rel=\\\"nofollow\\\">Weibo.intl<\\/a>\"},{\"name\":\"\\u4f60\\u89c1\\u5230\\u6211\\u7684\\u5c0f\\u5f90\\u9e2d\\u4e86\\u5417\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5768508739,\"target_id\":\"4421889047367155\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"China No.1 <a href=\\\"http:\\/\\/t.cn\\/ELT0hke\\\" target=\\\"_blank\\\">http:\\/\\/t.cn\\/ELT0hke<\\/a> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/006io4Dxly1g7gg1ap5u0j33402c0x6q.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"006io4Dxly1g7gg1ap5u0j33402c0x6q.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"Mr\\u4e36\\u5f35\\u4f73\\u5be7\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5237759039,\"target_id\":\"4421866749483663\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u966a\\u4e86\\u6211\\u4e94\\u5e74\\u7684\\u676f\\u5b50\\uff0c\\u788e\\u4e86<img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/9d\\/sada_org.gif\\\" title=\\\"\\u6cea\\\"\\/><img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/9d\\/sada_org.gif\\\" title=\\\"\\u6cea\\\"\\/><img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/9d\\/sada_org.gif\\\" title=\\\"\\u6cea\\\"\\/>\\uff0c\\u5509\\u5440\\u3002 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/005It6ovly1g7gdhr5vp7j32o03k0b2g.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"005It6ovly1g7gdhr5vp7j32o03k0b2g.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/6NndUT\\\" rel=\\\"nofollow\\\">Weibo.intl<\\/a>\"},{\"name\":\"\\u6211\\u60f3\\u5f53\\u9526\\u9ca4llly\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5861668638,\"target_id\":\"4421823116135582\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u8bfe\\u4ee3\\u8868\\u6536\\u4f5c\\u4e1a\\u5939\\u5728\\u91cc\\u8fb9\\u7684\\u5c0f\\u7eb8\\u6761\\n\\u600e\\u4e48\\u4f1a\\u6709\\u8fd9\\u4e48\\u53ef\\u7231\\u7684\\u5b69\\u5b50<img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/40\\/hearta_org.gif\\\" title=\\\"\\u5fc3\\\"\\/>\\n\\u4e00\\u4e0a\\u5348\\u90fd\\u662f\\u597d\\u5fc3\\u60c5<img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/0b\\/tootha_org.gif\\\" title=\\\"\\u563b\\u563b\\\"\\/> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/006oGXMyly1g7g8gc5g34j30tu13u7wh.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"006oGXMyly1g7g8gc5g34j30tu13u7wh.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"\\u840c\\u5b50lmm\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5301719605,\"target_id\":\"4420069679355304\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u5e26\\u4e0a\\u6211\\u7684\\u5c0f\\u76ae\\u7b4b \\u5c31\\u662f\\u6211\\u7684\\u4eba\\u5566[\\u8214\\u5c4f] \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx1.sinaimg.cn\\/small\\/005MNtsxly1g7an3oikooj30u0140afe.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx1.sinaimg.cn\",\"pic_name\":\"005MNtsxly1g7an3oikooj30u0140afe.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/5q6DIx\\\" rel=\\\"nofollow\\\">\\u8363\\u80007X \\u5168\\u9762\\u5c4f\\u624b\\u673a<\\/a>\"},{\"name\":\"\\u51b0\\u6ceea\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5234448711,\"target_id\":\"4417283877260775\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u9759\\u7b49...<a class=\\\"\\\" href=\\\"http:\\/\\/huati.weibo.com\\/k\\/%E8%AF%B4%E5%A5%BD%E4%B8%8D%E5%93%AD\\\" target=\\\"_blank\\\" >#\\u8bf4\\u597d\\u4e0d\\u54ed#<\\/a> <a href=\\\"\\/\\/photo.weibo.com\\/n\\/\\u5468\\u6770\\u4f26\\/albums\\\" target=\\\"_blank\\\" action-type=\\\"get_card\\\" action-data=\\\"\\u5468\\u6770\\u4f26\\\">@\\u5468\\u6770\\u4f26<\\/a> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx4.sinaimg.cn\\/small\\/005Ifde7ly1g71r5dhhyyj30u01bo45o.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx4.sinaimg.cn\",\"pic_name\":\"005Ifde7ly1g71r5dhhyyj30u01bo45o.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/4Eaa5v\\\" rel=\\\"nofollow\\\">\\u5c0f\\u7c73Note 3 \\u62cd\\u4eba\\u66f4\\u7f8e<\\/a>\"},{\"name\":\"\\u840c\\u5b50lmm\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5301719605,\"target_id\":\"4416163699904481\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u53bb\\u60a6\\u8bd7\\u98ce\\u541f\\u4e70\\u4e2a\\u776b\\u6bdb\\u818f \\u4e0d\\u5c0f\\u5fc3\\u8e6d\\u4e86\\u6574\\u4e2a\\u5986[\\u6c61]\\n\\u7cbe\\u81f4\\u732a\\u732a\\u4e00\\u679a\\uff5e \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx3.sinaimg.cn\\/small\\/005MNtsxly1g6y6i52j8ij30u0140wix.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx3.sinaimg.cn\",\"pic_name\":\"005MNtsxly1g6y6i52j8ij30u0140wix.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/5q6DIx\\\" rel=\\\"nofollow\\\">\\u8363\\u80007X \\u5168\\u9762\\u5c4f\\u624b\\u673a<\\/a>\"},{\"name\":\"\\u641e\\u7b11\\u767e\\u79d1\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":1762640091,\"target_id\":\"4409999107611780\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u54c8\\u54c8\\u54c8\\u5343\\u4e07\\u4e0d\\u8981\\u5e26\\u7238\\u5988\\u53bb\\u6cf0\\u56fd\\uff01\\u8fd9\\u6ee1\\u6ee1\\u4e0d\\u53ef\\u63cf\\u8ff0\\u7684\\u5c34\\u5c2c\\u6c14\\u606f[\\u5141\\u60b2][\\u5141\\u60b2] \\u200b\\u200b\\u200b\\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/690fc0dbgy1g6eftzzhp6j20c804j3ys.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"690fc0dbgy1g6eftzzhp6j20c804j3ys.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/6vtZb0\\\" rel=\\\"nofollow\\\">\\u5fae\\u535a weibo.com<\\/a>\"},{\"name\":\"\\u5c0f\\u5575\\u513f\\u8d85\\u5440\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5599812785,\"target_id\":\"4404967881917951\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u5b66\\u4f1a\\u5fcd\\u53d7\\u5b64\\u72ec\\u662f\\u4eba\\u751f\\u5fc5\\u4fee\\u8bfe<img height=\\\"22\\\" src=\\\"https:\\/\\/img.t.sinajs.cn\\/t4\\/appstyle\\/expression\\/ext\\/normal\\/e5\\/sun.gif\\\" title=\\\"\\u592a\\u9633\\\"\\/> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx4.sinaimg.cn\\/small\\/0066Yf73ly1g5ygmd7nqrj30dw06nt8z.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx4.sinaimg.cn\",\"pic_name\":\"0066Yf73ly1g5ygmd7nqrj30dw06nt8z.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/app.weibo.com\\/t\\/feed\\/22Arqb\\\" rel=\\\"nofollow\\\">HUAWEI P30<\\/a>\"},{\"name\":\"\\u6211\\u60f3\\u5f53\\u9526\\u9ca4llly\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5861668638,\"target_id\":\"4404916720073207\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u666f\\u8272\\u5f88\\u7f8e\\u597d\\uff0c\\u5c31\\u662f\\u868a\\u5b50\\u6709\\u70b9\\u591a[\\u4e8c\\u54c8][\\u4e8c\\u54c8] <a href=\\\"http:\\/\\/t.cn\\/RyhYtgF\\\" target=\\\"_blank\\\">http:\\/\\/t.cn\\/RyhYtgF<\\/a> \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx2.sinaimg.cn\\/small\\/006oGXMyly1g5yasuf2g0j33402c01i3.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx2.sinaimg.cn\",\"pic_name\":\"006oGXMyly1g5yasuf2g0j33402c01i3.jpg\",\"pic_type\":1,\"from\":\"<a href=\\\"http:\\/\\/weibo.com\\/\\\" rel=\\\"nofollow\\\">iPhone\\u5ba2\\u6237\\u7aef<\\/a>\"},{\"name\":\"Mr\\u4e36\\u5f35\\u4f73\\u5be7\",\"album_id\":\"\",\"uid\":\"5731326417\",\"like_uid\":5237759039,\"target_id\":\"4400624550123207\",\"type\":15,\"flag\":1,\"property\":1,\"is_private\":false,\"album_caption\":\"\\u5fae\\u535a\\u914d\\u56fe\",\"caption\":\"\\u4e0d\\u4ee5\\u7269\\u559c\\uff0c\\u4e0d\\u4ee5\\u5df1\\u60b2\\u3002 \\u200b\",\"thumbnail_pic\":\"https:\\/\\/wx1.sinaimg.cn\\/small\\/005It6ovly1g5kluue6znj311y0lcjt1.jpg\",\"question\":\"\",\"visible_type\":0,\"pic_host\":\"https:\\/\\/wx1.sinaimg.cn\",\"pic_name\":\"005It6ovly1g5kluue6znj311y0lcjt1.jpg\",\"pic_type\":1,\"from\":\"\"}]}}"
response = json.loads(text)

"""图片保存文件夹"""
dir_name = 'no_upload/jiao_like'
if not os.path.exists(dir_name):
    os.mkdir(dir_name)
    os.chdir(dir_name)
else:
    os.chdir(dir_name)

middle = '/sq612/'  # 高清（原）图片
for item in response['data']['photos_list']:
    name = item['name']  # 微博名称
    caption = item['caption']  # 微博内容
    pic_host = item['pic_host']  # 微博名称
    pic_name = item['pic_name']
    thumbnail_pic = item['thumbnail_pic']
    new_url = '%s%s%s' % (pic_host, middle, pic_name)  # 将三者连接得到图片链接
    r = requests.get(new_url)
    # 保存图片
    with open(name + "-" + pic_name, 'wb') as f:
        f.write(r.content)  # 写入图片，文本为text，图片为content
    with open(name + ".txt", 'a+', encoding='utf-8') as f:
        f.write(caption)
        f.write("\n--------\n")
    print("获取完成")
